package com.zp.oj.judge.strategy;

import com.zp.oj.judge.model.ExecuteCodeRequest;
import com.zp.oj.judge.model.ExecuteCodeSandResponse;
import com.zp.oj.judge.model.JudgeInfo;
import com.zp.oj.model.entity.QuestionSubmit;

public class  JudgeManage implements JudgeStrategy {
    @Override
    public JudgeInfo doJudge(JudgeContent judgeContent, ExecuteCodeSandResponse executeCodeSandResponse) {
        QuestionSubmit questionSubmit = judgeContent.getQuestionSubmit();
        String language  = questionSubmit.getLanguage();
        JudgeInfo judgeInfoResult = new JudgeInfo();
        if(language.equals("java")){
            JudgeStrategy judgeStrategy = new JavaJudgeStrategy();
            judgeInfoResult = judgeStrategy.doJudge(judgeContent, executeCodeSandResponse);
        }else {
            JudgeStrategy judgeStrategy = new DefaultJudgeStrategy();
            judgeInfoResult = judgeStrategy.doJudge(judgeContent, executeCodeSandResponse);
        }
        return judgeInfoResult;
    }
}
